<?php
/**
 * Created by PhpStorm.
 * User: zcq
 * Date: 2018/10/15
 * Time: 9:25
 */

namespace app\admin\service;


use app\common\RedisCache;

class BaseService
{
    public function __construct()
    {

    }

    /**
     * @param $voteId
     * 清除活动的redis缓存
     */
    public function clearVoteCache($voteId)
    {
        $key = 'vote_'.$voteId;
        return RedisCache::getInstance()->cache($key,null);
    }

    /**
     * @param $voteId
     * 清除活动白名单的redis缓存
     */
    public function clearVoteWhite($voteId)
    {
        $key = 'vote_white_'.$voteId;
        return RedisCache::getInstance()->cache($key,null);
    }

    /**
     * @param $voteId
     * @return bool|int|string
     * 清除参加活动的作品的redis缓存
     */
    public function clearVoteItems($voteId)
    {
        $key = 'vote_items_'.$voteId;
        return RedisCache::getInstance()->cache($key,null);
    }

    /**
     * @param $voteItemId
     * 清除某个参与投票活动的数据的评论
     */
    public function clearComment($voteItemId)
    {
        $key = 'comment_'.$voteItemId;
        return RedisCache::getInstance()->cache($key,null);
    }

    /**
     * @param $voteId
     * 清除投票的分类
     */
    public function clearVoteType($voteId)
    {
        $key = 'vote_type_'.$voteId;
        return RedisCache::getInstance()->cache($key,null);
    }

    /**
     * @param $oneId
     * @return bool|int|mixed|string
     * 清除一元购活动的缓存
     */
    public function clearOne($oneId){
        $key = 'one_'.$oneId;
        return RedisCache::getInstance()->cache($key,null);
    }
}